package test_junit_shop.ProductStock;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
import util.BaseDriver;

public class AddStorage extends BaseDriver{

    private AddStorage(){ }

    private static AddStorage instance=new AddStorage();

    public static AddStorage getInstance(){
        return instance;
    }


    public void addStorage() throws InterruptedException {


        Thread.sleep(2000);
        driver=driver.switchTo().frame(2);
        driver.findElement(By.cssSelector("button.btn.btn-sm.btn-outline.btn-primary")).click();

        Thread.sleep(2000);
        driver=driver.switchTo().frame(0);
        driver.findElement(By.name("name")).click();
        driver.findElement(By.name("name")).clear();
        driver.findElement(By.name("name")).sendKeys("测试用例2");
        driver.findElement(By.id("type")).click();
        new Select(driver.findElement(By.id("type"))).selectByVisibleText("综合");
        driver.findElement(By.cssSelector("option[value=\"0\"]")).click();
        driver.findElement(By.name("address")).click();
        driver.findElement(By.name("address")).clear();
        driver.findElement(By.name("address")).sendKeys("20");
        driver.findElement(By.id("phone")).click();
        driver.findElement(By.id("phone")).click();
        driver.findElement(By.id("phone")).clear();
        driver.findElement(By.id("phone")).sendKeys("15084978667");
        driver=driver.switchTo().parentFrame();
        driver.findElement(By.linkText("确定")).click();



    }



}
